package com.sy.core.service;

import com.sy.core.mapper.SyProductTypeMapper;
import com.sy.core.model.SyProductType;
import com.sy.core.web.BaseCtl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("productTypeService")
public class ProductTypeService extends BaseCtl {
    @Autowired
    private SyProductTypeMapper syProductTypeMapper;

    public List<Map<String,Object>> queryList(Map<String,Object> map){
        return syProductTypeMapper.queryList(map);
    }

    public Integer saveOrUpdate(SyProductType syProductType) {
        if(syProductType.getPk()==null||syProductType.getPk()==""){
            syProductType.setPk(getPrimaryKey());
            return syProductTypeMapper.insertSelective(syProductType);
        }else{
            return syProductTypeMapper.updateByPrimaryKeySelective(syProductType);
        }

    }

    public Map<String,Object> queryOne(String pk) {
        return  syProductTypeMapper.selectByPrimaryKeyForMap(pk);
    }

    public int batchDel(String pks) {
        return syProductTypeMapper.batchDel(pks);
    }
}
